Repository navigation
feat(parser): print function bodies like bash and close BashBox parser gaps (45 cases) - #2599
Merged
Merged
Conversation
Copies (script, stdout) pairs from shipfastlabs/bashbox (MIT) into spec_cases/bash/bashbox-*.test.sh, keeping only cases whose recorded output matches host bash. 624 pass and join the bash comparison gate; 420 are marked TODO skips: real gaps where bashkit differs from bash. Attribution in NOTICE; process in knowledge/operations/testing.md.
…-eafupr-bashbox-corpus # Conflicts: # THIRD_PARTY_LICENSES/README.md
…r gaps
- type / declare -f print function bodies via a print_cmd.c port
(parser/print_cmd.rs); words keep source text while parsing function
bodies; function bodies may be any compound command with redirections
- (( )) and for (( )) read raw up to the matching )); heredoc delimiter
quoting decided from its source text; several heredocs per command
- ]] closes [[ only as a whole word; |& is 2>&1 |
- backquoted bodies that fail to parse error at run time (status 2)
- process substitution ends where the substitution scanner closes it
- ${x:-$(cmd)} runs operand substitutions only when the operand is used;
quoted replacement text keeps } inside '...'
- LINENO honors local/unset; script children keep caller cwd and shared
stdin position; command ./script runs scripts; eval/source parse
errors exit 2
- simple-command word/redirect handling outlined so nested $( ) parsing
uses less stack than before
…-eafupr-bb-printer # Conflicts: # crates/bashkit/src/parser/mod.rs # crates/bashkit/tests/spec_cases/bash/bashbox-compound-syntax.test.sh # crates/bashkit/tests/spec_cases/bash/bashbox-lexer.test.sh # crates/bashkit/tests/spec_cases/bash/bashbox-line-number.test.sh # crates/bashkit/tests/spec_cases/bash/bashbox-parser.test.sh # crates/bashkit/tests/spec_cases/bash/bashbox-script-file.test.sh # crates/bashkit/tests/spec_cases/bash/bashbox-syntax-error.test.sh # crates/bashkit/tests/spec_cases/bash/bashbox-type-printer.test.sh
…-eafupr-bb-printer # Conflicts: # crates/bashkit/src/parser/lexer.rs # crates/bashkit/src/parser/mod.rs
…-eafupr-bb-printer
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 84f7841 | Commit Preview URL Branch Preview URL |
Oct 07 2026, 10:56 PM |
…-eafupr-bb-printer
A function call is the recursion path. Dispatching it from the same future as the builtin and PATH-search arms put that whole frame on the stack at every call level, so 16 nested calls overflowed a 2 MiB stack in debug builds. Functions now get their own small future. Also adds the raw field to the Word built by main's array-literal change.
The unary-sign change made 2 ** -1 parse its exponent as -1, which the clamp turned into 2 ** 0 = 1. Keep the evaluator's error value 0.
…-eafupr-bb-printer # Conflicts: # crates/bashkit/src/interpreter/mod.rs
…-eafupr-bb-printer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Михайло · project thread
What changed
type f,declare -f fanddeclare -pnow print function bodies the way bash does: a port of bash'sprint_cmd.cwith its indentation,;placement, redirections, here-documents,case/select/(( ))/[[ ]]/coproc and nested functions.Parser fixes that came out of the same cases:
(( ))is kept as raw text, so the arithmetic prints back unchanged.]]handling inside[[ ]].|&.3 - -1).Why
Fourth step of adopting the BashBox corpus (#2575): function printing was a whole cluster of its bash-verified failures, and agents use
type/declare -fto inspect what they defined.Before / After
BashBox corpus cases still skipped: 420 → 375 (45 unskipped: type 25, syntax 7, lexer 4, script 4, parser 2, compound 2, line 1).
Example now passing, output identical to bash:
Risk
parallel_executionbench showed no regression over 10%.&>>inside a function prints as>> f 2>&1(bash prints&>> f). Expansion errors such as$((1/0))aborting the line are documented as a gap inknowledge/.Checklist
Generated by Claude Code